package com.baosight.sczx.common.zm.cInterface.cs;

import java.util.HashMap;
import java.util.List;

import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;
import com.baosight.sczx.common.zm.cInterface.CmesConstants;
import com.baosight.sczx.zm.cs.domain.ZMCSSystemSettingCL;

public class SystemSettingCL {

	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	private static SystemSettingCL instance = new SystemSettingCL();
	private static ZMCSSystemSettingCL systemSetting;
	
	private SystemSettingCL(){
		initData();//当第一次使用的时候初始化
	}
	
	@SuppressWarnings("unchecked")
	private void initData(){
		List<ZMCSSystemSettingCL> _list = dao.query("ZMCSSystemSettingCL.query", new HashMap<String, String>());
		if(_list.size() < 1) {
			systemSetting = null;
		}
		else {
			systemSetting = _list.get(0);
		}
		CmesConstants.SYSTEMSETTING_CL = 0;
	}
	
	/**
	 * 安全主管部门ID
	 * <p>Function: getManageDepartId</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-7-18上午02:15:59 严洪浩
	 * </p>
	 *
	 */
	public String getManageDepartId(){
		String _temp = new String("");
		if(systemSetting != null) {
			_temp = systemSetting.getFdManageDepartId();
		}
		
		return _temp.toString();
	}
	
	
	/**
	 * 得到对象的唯一句柄
	 * <p>Function: getInstance</p>
	 * <p>Description: </p>
	 * <p>return value:SystemSettingCL</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午07:50:20 严洪浩
	 * </p>
	 *
	 */
	public static SystemSettingCL getInstance(){
		if(CmesConstants.SYSTEMSETTING_CL == 1) {
			instance = new SystemSettingCL();
		}
		
		return instance;
	}
	
}
